package ${basePackageName}.controller.admin;

import cn.iocoder.yudao.framework.business.basic.annotation.AdminJsonView;
import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.business.basic.controller.SimpleDetailController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import ${basePackageName}.pojo.dto.${queryObject};
import ${basePackageName}.pojo.vo.${viewObject};
import ${package.Service}.${table.serviceName};
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * 前端控制器
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
*
* @author ${author}
* @since ${date}
*/
@Tag(name = "管理后台 - ${table.comment!}")
@RestController
@RequestMapping("${routePath}")
public class ${table.controllerName} implements SimpleDetailController<${viewObject}>, PageController<${viewObject}, ${queryObject}> {
    @Resource
    private ${table.serviceName} ${serviceNameVar};

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @JsonView(AdminJsonView.class)
    @Override
    public CommonResult<${viewObject}> getDetail(Long id) {
        return CommonResult.success(${serviceNameVar}.getDetail(id));
    }

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @JsonView(AdminJsonView.class)
    @Override
    public CommonResult<PageResult<${viewObject}>> getPage(Integer pageNo, Integer pageSize, ${queryObject} param) {
        return CommonResult.success(${serviceNameVar}.getPage(pageNo, pageSize, param));
    }

}
